<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/4/24 0024
 * Time: 下午 4:24
 */

namespace app\sports_admin\vaildate;


class School extends Base
{
    protected $rule = [
        'id'=>'require|isPositiveInteger',
    ];

    protected $message = [
        'id'=>'编号必须为整数',
    ];
    //添加验证
    public function insert()
    {
        $rule = [
            'school_name'=>'require',
            'login'=>'require',
            'password'=>'require',
            'phone_name'=>'require',
            'phone'=>'require|/^1[3-8]{1}[0-9]{9}$/',
            'url'=>'require',
            'email'=>'require|email',
            'province'=>'require|array',
            'start'=>'require',
            'end'=>'require',
            'type'=>'require|array',
        ];
        $msg = [
            'school_name'=>'请输入学校名称',
            'login'=>'请输入登录账号',
            'password'=>'请输入密码',
            'phone_name'=>'请输入联系人',
            'phone'=>'请输入正确的手机号',
            'url'=>'请输入正确的连接地址',
            'email'=>'请输入正确的电子邮件',
            'province'=>'请选择地址',
            'start'=>'请选择开始时间',
            'end'=>'请选择结束时间',
            'type'=>'请选择年级类别',
        ];
        self::goCheck($rule,$msg);
    }
    //修改验证
    public function update()
    {
        $rule = [
            'id'=>'require|integer',
            'school_name'=>'require',
            'phone_name'=>'require',
            'phone'=>'require|/^1[3-8]{1}[0-9]{9}$/',
            'url'=>'require',
            'email'=>'require|email',
            'province'=>'require|array',
            'start'=>'require',
            'end'=>'require',
            'type'=>'require|array',
        ];
        $msg = [
            'id'=>'请选择需要修改的信息',
            'school_name'=>'请输入学校名称',
            'phone_name'=>'请输入联系人',
            'phone'=>'请输入正确的手机号',
            'url'=>'请输入正确的连接地址',
            'email'=>'请输入正确的电子邮件',
            'province'=>'请选择地址',
            'start'=>'请选择开始时间',
            'end'=>'请选择结束时间',
            'type'=>'请选择年级类别',
        ];
        self::goCheck($rule,$msg);
    }
}